/** 支付工具 */
class PayUtils {
	/** APP微信支付 */
	static appWeixinPay(info, options = {}) {
		return new Promise((resolve, reject) => {
			uni.requestPayment({
				provider: "wxpay",
				orderInfo: info,
				success: res => { resolve(res) },
				fail: err => reject(err),
				complete: () => { uni.hideLoading(); }
			})
		})
	}
	/** APP支付宝支付 */
	static appAliPay(info, options = {}) {
		return new Promise((resolve, reject) => {
			uni.requestPayment({
				provider: "alipay",
				orderInfo: info,
				success: res => { resolve(res) },
				fail: err => reject(err),
				complete: () => { uni.hideLoading(); }
			})
		})
	}
	/** 小程序支付 */
	static appletPay(info, options = {}) {
		return new Promise((resolve, reject) => {
			uni.requestPayment({
				provider: "wxpay",
				...info,
				success: res => { resolve(res) },
				fail: err => reject(err),
				complete: () => { uni.hideLoading(); }
			})
		})
	}
}

export { PayUtils }